﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_AddNewServiceType : System.Web.UI.Page
{
    ServiceBlo _serviceBlo = new ServiceBlo();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            lblStatus.Visible = false;
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string _serviceName = txtPackageName.Text;
        List<ServiceDetail> _list = _serviceBlo.SelectService(_serviceName).ListServiceDetail;
        if (_list.Count != 0)
        {
            lblStatus.Visible = true;
            lblStatus.Text = "Add is not Successfull! The package name existed.";
            txtPackageName.Text = "";
            rbtnActive.Checked = true;
            return;
        }
        bool status = false;
        if (rbtnActive.Checked)
        {
            status = true;
        }
        _serviceBlo.InsertServiceType(_serviceName, status);
        Response.Redirect("");
    }
    
}